package net.comm.param.db;


import java.sql.ResultSet;
import java.sql.SQLException;


import net.comm.param.bean.BaseCnpca;

import org.apache.log4j.Logger;
import org.sakaiproject.db.api.SqlReader;

public class DbCnpcaService implements SqlReader
{

	static Logger logger = Logger.getLogger(DbCnpcaService.class.getName());

	/**
	 * Read from the result one set of fields to create a Resource.
	 * 
	 * @param result
	 *        The Sql query result.
	 * @return The Resource object.
	 */
	public Object readSqlResultRecord(ResultSet result)
	{
		try
		{
			
			int  		id = result.getInt(1);		//序号
			String  	name = result.getString(2);	//名称
			int  		pid = result.getInt(3);	//省ID
			int  		cid = result.getInt(4);	//市ID

			// create the Resource from these fields
			return new BaseCnpca( id, name,  pid,  cid);
		}
		catch (SQLException e)
		{
			logger.error("读取表数据持久层失败！");
			return null;
		}
		
	}
}
